package cn.tedu.ivos.dict.service.impl;


import cn.tedu.ivos.dict.mapper.DictMapper;
import cn.tedu.ivos.dict.pojo.dto.DictQuery;
import cn.tedu.ivos.dict.pojo.dto.DictSaveParam;
import cn.tedu.ivos.dict.pojo.vo.DictVO;
import cn.tedu.ivos.dict.service.DictService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
@Slf4j
public class ServiceImpl implements DictService {
    @Autowired
    DictMapper dictMapper;
    @Override
    public List<DictVO> select(DictQuery dictQuery) {
        List<DictVO> list = dictMapper.select(dictQuery);
        return list;
    }

    @Override
    public void delete(Long id) {
        dictMapper.delete(id);
        log.debug("根据字典类型删除字典数据,参数:{}",id);
    }

    @Override
    public void add(DictSaveParam dictSaveParam) {
        dictSaveParam.setCreateTime(new Date());
        dictSaveParam.setStatus("1");
        dictMapper.insert(dictSaveParam);
    }
}
